'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;

  // 各表的 CRUD
  router.get('/api/', controller.theClass.index);
  router.resources('/api/theClass', controller.theClass);
  router.resources('/api/student', controller.student);
  router.resources('/api/course', controller.course);
  router.resources('/api/experimentCourse', controller.experimentCourse);
  router.resources('/api/teacher', controller.teacher);
  router.resources('/api/laboratory', controller.laboratory);
  router.get('/api/experimentPlan/:ecId/:epBatch', controller.experimentPlan.show);
  router.put('/api/experimentPlan/:ecId/:epBatch', controller.experimentPlan.update);
  router.del('/api/experimentPlan/:ecId/:epBatch', controller.experimentPlan.destroy);
  router.resources('/api/experimentPlan', controller.experimentPlan);
  router.get('/api/experimentScore/:sId/:ecId', controller.experimentScore.show);
  router.put('/api/experimentScore/:sId/:ecId', controller.experimentScore.update);
  router.del('/api/experimentScore/:sId/:ecId', controller.experimentScore.destroy);
  router.resources('/api/experimentScore', controller.experimentScore);
  router.get('/api/experimentTotalScore/:sId/:cId', controller.experimentTotalScore.show);
  router.put('/api/experimentTotalScore/:sId/:cId', controller.experimentTotalScore.update);
  router.del('/api/experimentTotalScore/:sId/:cId', controller.experimentTotalScore.destroy);
  router.resources('/api/experimentTotalScore', controller.experimentTotalScore);

  // 登录相关
  router.get('/api/getTokenInfo', controller.login.getTokenInfo);
  router.get('/api/logout', controller.login.logout);
  router.post('/login', controller.login.login);
};
